<?php
	
	class Page{


		public $total;

		public $pageSize;

		public $curr;

		public $pages;

		public $beg;

		public function Page($total,$curr,$pageSize=10){

			$this->total = $total;
			$this->pageSize = $pageSize;
			$this->curr =  intval($curr) ?  intval($curr) : 1;;

			$this->init();
		}


		public function Init(){
			
			$this->pages = $this->total % $this->pageSize;
			if ($this->pages == 0) {
				$this->pages = intval($this->total) / $this->pageSize;
			} else {
				$this->pages = intval($this->total / $this->pageSize) + 1;
			}

			$this->beg = $this->pageSize * ($this->curr - 1);

		}

		public function Show( $id, $callback = 'pageCallback'){
			echo "$(\"$id\").pager({ pagenumber: $this->curr, pagecount:  $this->pages, buttonClickCallback: $callback });";
		}

	}